package cn.sangyy.auth.service.impl;

import cn.sangyy.auth.domain.Permiss;
import cn.sangyy.auth.mapper.PermissMapper;
import cn.sangyy.auth.query.PerQuery;
import cn.sangyy.auth.service.IPermissionService;
import cn.sangyy.basic.utils.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author SangYY
 * @date: 2023/05/17/14:24
 */
@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private PermissMapper permissMapper;

    @Override
    public PageList<Permiss> pageList(PerQuery perQuery) {
        long total = permissMapper.getTotal(perQuery);
        if(total > 0){
            List<Permiss> rows = permissMapper.getPageData(perQuery);
            return new PageList<>(total,rows);
        }
        return new PageList<>();
    }

    @Override
    public List<Permiss> tree() {
        return permissMapper.tree();
    }
}
